#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
void find1(long a[4],int b[][5])
{
	int i;
	for (i = 0; i < 4; i++)
	{
		int sum = 0;
		int j,flag=0;
		for (j = 0; j < 5; j++)
		{
			if (b[i][j] < 60)
				flag++;
			sum += b[i][j];
		}
		if (flag >= 2)
		{
			double temp = (double)sum / 5;
			printf("%d ", a[i]);
			int k;
			for (k = 0; k < 5; k++)
			{
				printf("%d ", b[i][k]);
			}
			printf("%.2lf\n", temp);
		}

	}
}
void find2(long a[4], int b[][5])
{
	int i;
	for (i = 0; i < 4; i++)
	{
		int sum = 0,j;
		int flag=1;
		for (j = 0; j < 5; j++)
		{
			sum += b[i][j];
			if (b[i][j] < 85)
				flag = 0;
		}
		if (sum>=90*5||flag==1)
			printf("%d ", a[i]);
	}
}
int main()
{
	long a[4];
	int b[4][5];
	int i = 0;
	for (i = 0; i < 4; i++)
	{
		scanf("%d", &a[i]);
		int j = 0;
		for (j = 0; j < 5; j++)
		{
			scanf("%d", &b[i][j]);
		}
	}
	double t = (double)(b[0][0] + b[1][0] + b[2][0] + b[3][0]) / 4;
	printf("%.2lf\n", t);
	find1(a, b);
	find2(a, b);
	printf("\n");
}